package de.puc.defencetower.view.gui;

import java.awt.Color;
import java.awt.Label;

import javax.swing.BoxLayout;

import de.puc.defencetower.controller.iGameController;
import de.puc.defencetower.model.Map;
import de.puc.defencetower.view.gui.GamePanel;

@SuppressWarnings("serial")
public class StatusPanel extends GamePanel{
	
	private Label valueWave;
	private Label valueGold;
	private Label valueLive;
	private Label valueSTTNS;
	private  static final String LABEL_TEXT_WAVE = "Wave: ";
	private  static final String LABEL_TEXT_GOLD = "Gold: ";
	private  static final String LABEL_TEXT_LIVE = "Live: ";
	private  static final String LABEL_TEXT_STTNS = "Seconds to the next Spawn: ";

	public StatusPanel(Map map, iGameController gameControlerInterface, GUIWindow gameWindow) {
		super(map, gameControlerInterface, gameWindow);
		
		setBackground(Color.white);
		setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
		init();
	}
	
	private void init() {
		valueWave = new Label();
		valueGold = new Label();
		valueLive = new Label();
		valueSTTNS = new Label();
		
		add(new Label(LABEL_TEXT_WAVE));
		add(valueWave);
		add(new Label(LABEL_TEXT_GOLD));
		add(valueGold);
		add(new Label(LABEL_TEXT_LIVE));
		add(valueLive);
		add(new Label(LABEL_TEXT_STTNS));
		add(valueSTTNS);
	}

	@SuppressWarnings("deprecation")
	public void refresh(){
		valueWave.setText(""+getMap().getMonstersSpawned());
		valueGold.setText(""+getMap().getGold());
		valueLive.setText(""+getMap().getLive());
		valueSTTNS.setText(""+getMap().getSecondsToNextSpawn().getSeconds());
	}
}
